package com.hand.wfive.activity.picker

import android.content.Context
import android.content.Intent
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
import com.qmuiteam.qmui.util.QMUIDisplayHelper
import com.hand.wfive.R
import com.hand.wfive.entity.Params
import kotlinx.android.synthetic.main.activity_picker_preview_image.*

class PreviewImageActivity : BasePreviewActivity() {

    companion object {
        fun showIntent(context: Context, path: String): Intent {
            val intent = Intent(context, PreviewImageActivity::class.java)
            intent.putExtra(Params.path, path)
            return intent
        }
    }

    override fun getContentViewId() = R.layout.activity_picker_preview_image

    override fun onPreviewFile() {
        Glide.with(mContext).load(mPath)
            .skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE)
            .override(QMUIDisplayHelper.getScreenHeight(mContext))
            .placeholder(photo_view.drawable)
            .into(photo_view)
    }

    override fun getUploadFileType() = Params.fileTypeImage
}